package com.hp.sso.connet;

import org.springframework.social.connect.ApiAdapter;
import org.springframework.social.connect.ConnectionValues;
import org.springframework.social.connect.UserProfile;

import com.hp.sso.api.QQAPIInterface;
import com.hp.sso.bean.QQUserInfo;

public class QQAPiAdapter implements ApiAdapter<QQAPIInterface> {

	@Override
	public UserProfile fetchUserProfile(QQAPIInterface arg0) {
		return null;
	}

	@Override
	public void setConnectionValues(QQAPIInterface api, ConnectionValues values) {
		QQUserInfo userInfo = api.getUserInfo();
		values.setDisplayName(userInfo.getNickname());
		values.setImageUrl(userInfo.getFigureurl_qq_1());
		values.setProfileUrl(null);
		values.setProviderUserId(userInfo.getOpenId());
	}
	
	/***
	 * 测试api是否用
	 */
	@Override
	public boolean test(QQAPIInterface arg0) {
		return true;
	}

	@Override
	public void updateStatus(QQAPIInterface arg0, String arg1) {
	}

}
